package 其他.Acwing;

import org.junit.Test;

import java.util.Collections;
import java.util.Scanner;
import java.util.Stack;

public class jiema_gnngnngnn {
    public static void jiema(String w) {
        s = w.toCharArray();
        bT(0, w.length() - 1);
    }
    static class node {
        int num;
        char c;
        node(int x, char a) {
            num = x;
            c = a;
        }
        @Override
        public String toString() {
            return String.format("num=%s, c=%s", num, c);
        }
    }
    static Stack<node> stack = new Stack<>();

    //                      要算
    private static void bT(int l, int r) {
        if (l >= r) {
            return;
        }
        //算
        stack.push(new node(Integer.parseInt(s[l] + ""), s[l + 2]));

        // 下个（要算）
        bT(l + 3, r - 1);
    }

    static char[] s;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        s = S.toCharArray();
        jiema(S);
        String r = "";
        while (!stack.isEmpty()) {
            node node = stack.pop();
            int num = node.num, c = node.c;
            char cc = (char) c;
            r = cc+r;
            r = String.join("", Collections.nCopies(num, r));
        }
        System.out.println(r);
    }


    String copyStrByNum(String s ,int num){
        String res = "";
        for (int i = 0; i < num; i++) {
            res += s;
        }
        return res;
    }
    @Test
    public void test() {
        String s1 = copyStrByNum("n",2);
        String s2 = copyStrByNum("g"+s1,3);
        //                          "s"+s2
        //                      -> 第一个"n" + "" 即可循环 -> 靠举例出的
        System.out.println("RES:" + s2);
    }
}
